import 'package:flutter/material.dart';

import '../pages/alarm_view/alarm_view.dart';
import '../pages/dropswitch_view/dropswitch_view.dart';
import '../pages/envmonitoring_view/envmonitoring_view.dart';
import '../pages/home_view/home_view.dart';
import '../pages/layout_view/layout_view.dart';
import '../pages/login_view/login_view.dart';
import '../pages/selectionarea_view/selectionarea_view.dart';
import '../pages/voiceprintmonitor_view/voiceprintmonitor_view.dart';
import '../pages/waterinvasion_view/waterinvasion_view.dart';
import '../pages/wirelesstm_view/wirelesstm_view.dart';

//import '../pages/settingzoom_view/settingzoom_view.dart';
import '../pages/changepwd_view/changepwd_view.dart';
import '../pages/introduce_view/introduce_view.dart';
import '../pages/update_view/update_view.dart';

//配置路由
final routes = {
  '/loginview': (context) => LoginView(), // 登录
  '/selectionareaview': (context) => SelectionareaView(), // 选择台区
  '/layoutview': (context) => LayoutView(), // 盒子容器
  '/homeview': (context) => HomeView(), // 信息总览
  '/alarmview': (context) => AlarmView(), // 历史告警
  '/voiceprintmonitorview': (context) => VoiceprintmonitorView(), // 声纹波动监测
  '/dropswitchview': (context) => DropswitchView(), // 跌落开关监测
  '/wirelesstmview': (context) => WirelesstmView(), // 无线无缘测温
  '/envmonitoringview': (context) => EnvmonitoringView(), // 环境监测
  '/waterinvasionview': (context) => WaterinvasionView(), // 水浸监测
//  '/settingzoomview': (context) => SettingzoomView(),                           // 字体显示大小
  '/changepwdview': (context) => ChangePwdView(), // 修改密码
  '/introduceview': (context) => IntroduceView(), // 关于App
  '/updateview': (context) => UpdateView(), // 应用更新
};

//处理函数
var onGenerateRoute = (RouteSettings settings) {
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =
          MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};
